import React from 'react'
import { TextareaItem } from 'antd-mobile'
import classNames from 'classnames'
import FormItemHOC from './form-hoc'

import './index.less'

const prefixCls = 'zhang-form-textarea-item'

class Textarea extends React.PureComponent {
  static defaultProps = {
    editable: true,
    autoHeight: true
  }

  render() {
    const {
      className,
      ...others
    } = this.props

    const cls = classNames({
      [prefixCls]: true,
      [className]: className,
      'zhang-form-textarea-item-editable': this.props.editable
    })

    return (
      <div className={cls}>
        <TextareaItem {...others}/>
      </div>
    )
  }
}

export default FormItemHOC(Textarea)